package com.wafersystems.cloud.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.wafersystems.cloud.bo.MyProps;
import com.wafersystems.cloud.bo.SwitchLocalDoor;
import com.wafersystems.cloud.bo.abstractbo.AbstractSwitchDevice;
import com.wafersystems.cloud.service.impl.devicecontroller.modbus.ModbusDoController;
import com.wafersystems.cloud.service.impl.noticeservice.WebsocketNotice;

import lombok.extern.slf4j.Slf4j;

@Slf4j
@Service("DeviceService")
public class DeviceService {
  @Autowired
  private MyProps myProps;

  public AbstractSwitchDevice getDiDevice(String deviceId) {
    AbstractSwitchDevice door = new SwitchLocalDoor();
    // 设置modobus控制器
    door.setDeviceControllerTools(new ModbusDoController());
    // 设置websocket通知控制器
    door.setNoticeTools(new WebsocketNotice());
    door.setDeviceId(deviceId);
    return door;
  }

  public AbstractSwitchDevice getDoDevice(String deviceId) {
    SwitchLocalDoor door = new SwitchLocalDoor();
    // 设置modobus控制器
    door.setDeviceControllerTools(new ModbusDoController());
    door.setDeviceId(deviceId);
    return door;
  }
}
